Backing up and Restoring a Single Database via SSH

At the moment, taking backups for a single database is not available in the Control Panel. This article will explain how you can back up and restore a single database via SSH.

Note:

  • For security reasons, only the accounts have passed our verification will be granted permission to the Shell / SSH service. If you would like to enable it, please update your billing information. Our staff will finish verifying your information within 2 hours.

  • You will need the Super permission to perform the operation. To change your user permission, please refer to the article “Changing database access permission for a user”.

Backup

1. Locate the target application

Log in to the Control Panel and locate your target application on the Home page or the My Applications page.

Locate the target application

2. Navigate to the Shell / SSH page

Click the "Manage" button on the Home page or the My Applications page to go to the Shell / SSH page.

 Navigate to the Shell / SSH page

3. Back up a database

Click the “Connect” icon on the Shell / SSH page to launch the command-line interface.

launch the command-line interface

In the command-line interface

For security reasons, only the accounts have passed our verification will be granted permission to the Shell / SSH service. If you would like to enable it, please update your billing information. Our staff will finish verifying your information within 2 hours.

Redirect to update billing information

Input the command “mysqldump -u <db_user> -p <db_name> > <file_name>”, followed by pressing the “Enter” key. You’ll be prompted for a password, enter your password. The system will start backing up your database.

<db_user>:the user name of the database you would like to back up <db_name>: the database name you would like to back up <file_name>: the name of your backup file. The file format is “.sql”

Execute the command ls to check the backup file you just made.

4. Export files

You can download the file on your local machine using FTPS. For details, please take a look at the documentation.

Restoration

1. Import files

Import the file from your local machine to the MySQL Server using FTPS. For details, please take a look at the documentation.

2. Connect to the database

Log in to the Control Panel, and click the “Connect” icon on the Shell / SSH page to launch the command-line interface.

launch the command-line interface

In the command-line interface

Input the command “mysql -u <user_name> -p”, followed by entering the password of the user.

<db_user>:a user name of the database

Switch to the database that needs to be restored by typing in the command: use <db_name>

Connect to the database

3. Restore the database

Enter the command: source /cloudclusters/<file_name> to restore the backup file.

<file_name>: the name of the backup file you would like to restore from.

E.g. source /cloudclusters/wp.sql

That's it! You've restore the database successfully.

Copyright © 2021 Cloud Clusters Inc. all right reserved,powered by GitbookRevised on 05/05/2023

results matching ""

    No results matching ""